home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2011 November
/
CHIP_2011_11.iso
/
Programy
/
Inne
/
Gry
/
Carnage_Contest
/
scripts
/
CC Original
/
tools
/
Wall.lua
< prev
Wrap
Text File
|
2009-09-28
|
2KB
|
55 lines
--------------------------------------------------------------------------------
-- Weapon Wall
-- Original Carnage Contest Weapon
-- Script by DC, September 2009, www.UnrealSoftware.de
--------------------------------------------------------------------------------
-- Setup Tables
if cc==nil then cc={} end
cc.wall={}
cc.wall.gfx_wpn={}
-- Load & Prepare Ressources
for i=0,1,1 do
cc.wall.gfx_wpn[i]=loadgfx("buildings/wall"..i..".bmp") -- Weapon Image
setmidhandle(cc.wall.gfx_wpn[i])
end
cc.wall.sfx_build=loadsfx("buildstone.ogg") -- Build Sound
--------------------------------------------------------------------------------
-- Weapon: Wall
--------------------------------------------------------------------------------
cc.wall.id=addweapon("cc.wall","Wall",cc.wall.gfx_wpn[0],0) -- Add Weapon (0 uses)
function cc.wall.draw() -- Draw
if weapon_shots==0 then
-- HUD Positioning
hudpositioning(pos_build,cc.wall.gfx_wpn[weapon_mode])
-- HUD Info
hudinfo("Press [Space] to rotate the wall!")
end
end
function cc.wall.attack(attack) -- Attack
if weapon_timer>0 then
weapon_timer=weapon_timer-1
end
if (weapon_shots<=0) and (attack==1) and (weapon_timer==0) then
-- Rotate
weapon_timer=15
weapon_mode=weapon_mode+1
if weapon_mode>1 then
weapon_mode=0
end
end
if (weapon_shots<=0) and (weapon_position==1) then
-- Use weapon and allow to use another one afterwards (1)
useweapon(1)
weapon_shots=weapon_shots+1
-- Draw
terrainimage(cc.wall.gfx_wpn[weapon_mode],weapon_x,weapon_y)
-- Sound
playsound(cc.wall.sfx_build)
end
end